package com.sun.androidexerciseproject.function.singleInstance;

import android.content.Context;

/**
 * Description:
 * File: StaticInnerSingleInstance.java
 * Author: Administrator
 * Create: 2018/11/29 0029 上午 9:58
 */
public class StaticInnerSingleInstance {
    private Context mContext;

    private StaticInnerSingleInstance() {

    }

    public static StaticInnerSingleInstance getInstance() {
        return Holder.INSTANCE;
    }

    public static StaticInnerSingleInstance getInstance(Context context) {
        if (null == Holder.INSTANCE.mContext) {
            Holder.INSTANCE.mContext = context;
        }
        return Holder.INSTANCE;
    }

    private static final class Holder {
        private static final StaticInnerSingleInstance INSTANCE = new StaticInnerSingleInstance();
    }
}
